﻿namespace Sirius.Mapper.Test.Enities
{
    using System;

    public class Customer : IEquatable<Customer>
    {
        public int? Id { get; set; }
        public int? ParentId { get; set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }
        
        public bool Equals(Customer other)
        {
            if (Id != other.Id)
                return false;

            if (ParentId != other.ParentId)
                return false;

            if (FirstName != other.FirstName)
                return false;

            return LastName == other.LastName;
        }
        public override int GetHashCode()
        {
            var hash = 13;

            hash = (hash * 7) + Id.GetValueOrDefault().GetHashCode();
            hash = (hash * 7) + ParentId.GetValueOrDefault().GetHashCode();
            hash = (hash * 7) + FirstName.GetHashCode();
            hash = (hash * 7) + FirstName.GetHashCode();
            hash = (hash * 7) + LastName.GetHashCode();

            return hash;
        }

        public override bool Equals(object obj)
        {
            if(obj is Customer)
            {
                return Equals(obj as Customer);
            }
            return false;
        }
    }
}